# Maintainer: David Runge <dave@sleepmap.de>
pkgname=zita-bls1
pkgver=0.3.3
pkgrel=3
pkgdesc="Blumlein Shuffler (binaural stereo signals to convential stereo speaker conversion)"
arch=('loong64' 'x86_64')
url="https://kokkinizita.linuxaudio.org/linuxaudio"
license=('GPL2')
groups=('pro-audio')
depends=('cairo' 'clthreads' 'clxclient' 'jack' 'zita-convolver')
makedepends=('gendesk')
source=("https://kokkinizita.linuxaudio.org/linuxaudio/downloads/${pkgname}-${pkgver}.tar.bz2")
sha512sums=('a23624e674fb5cbbdfb8bbf01ab9010f79a942d41bb3a9c564bdec5d01e56fba3b548c766bfe257f087929b7b9cd1decdd4b8a3b4d4beddcddb3bce8ac714463')

prepare() {
  cd "${pkgname}-${pkgver}"
  # strip march=native
  sed -e '/native/d' \
      -i source/Makefile
  # XDG desktop file
  gendesk -n \
          --pkgname ${pkgname} \
          --pkgdesc "${pkgdesc}" \
          --name zita-bls1 \
          --categories "AudioVideo;Audio"
}

build() {
  cd "${pkgname}-${pkgver}/source"
  make PREFIX=/usr
}

package() {
  cd "${pkgname}-${pkgver}/source"
  make PREFIX=/usr DESTDIR="$pkgdir" install

  # XDG desktop integration
  install -vDm 644 "../${pkgname}.desktop" \
    -t "${pkgdir}/usr/share/applications/"

  # docs
  install -t "${pkgdir}/usr/share/doc/${pkgname}" \
    -vDm 644 ../doc/html/* \
    -vDm 644 ../{AUTHORS,README}
}
